import { EnumUtil } from '/@/lib/enum';

/** 菜单类型 **/
export const MENU_TYPE = EnumUtil.create({
  MENU: [1, '菜单'], // 菜单下面配置页面
  PAGE: [2, '页面'], // 页面配置权限
  BOARD: [3, '看板'], // 看板独立运行
});

/** 用户菜单权限类型 **/
export const USER_MENU_OPERATION_TYPE = EnumUtil.create({
  IGNORE: [-1, '忽略'],
  FORBID: [0, '禁止'],
  ALLOW: [1, '允许'],
});

/** 编码规则字段类型 **/
export const CODING_RULE_TYPE = EnumUtil.create({
  FIXED: [3, '固定', '', { ruleName: '前缀', initVal: '' }],
  TIME: [2, '时间', '', { ruleName: '时间戳', initVal: 'yyyyMMdd' }],
  AUTOINCREMENT: [1, '自增', '', { ruleName: '自增长', initVal: '0001' }],
});

/** 物料类型 **/
export const MATERIAL_TYPE = EnumUtil.create({
  MATERIAL: ['material', '原料'],
  PRODUCT: ['product', '成品'],
  SEMI_MANUFACTURED: ['semiManufactured', '半成品'],
  PACKAGING_MATERIAL: ['packagingMaterial', '包材'],
  OTHER: ['other', "其他材料"],
  CUSTOMER: ['customer', "顾客财产(客供品)"]
});

/** 物料固定类目 **/
export const MATERIAL_CATEGORY = EnumUtil.create({
  MATERIAL: ['material', '原料'],
  PRODUCT: ['product', '成品'],
  SEMI_MANUFACTURED: ['semiManufactured', '半成品'],
  PACKAGING_MATERIAL: ['packagingMaterial', '包材'],
  STERILIZATION: ['sterilization', '灭菌'],
  RECYCLED: ['recycled', '循环料'],
});

// 打印机类型
export const PRINTER_TYPES = EnumUtil.create({
  ZEBRA: [1, '斑马打印机', '', { dpi: 200 }],
  A4: [2, 'A4打印机', '', { dpi: 72 }],
});

// 打印方向类型
export const PRINTER_DIRECTION_TYPES = EnumUtil.create({
  VERTICAL: [1, '竖向'],
  TRANSVERSE: [2, '横向'],
});

// 打印内容类型
export const PRINTER_CONTENT_TYPES = EnumUtil.create({
  STRING: [1, '字符串'],
  QR_CODE: [2, '二维码'],
  IMAGE: [3, '图片'],
});

// 打印缩放类型
export const PRINTER_ZOOM_TYPES = EnumUtil.create({
  ZOOM_OUT: [0.5, '缩小1倍'],
  ZOOM: [1, '原始比例'],
  ZOOM_IN: [2, '放大1倍'],
});

// 打印标签模板类型
export const PRINTER_TEMPLATE_TYPES = EnumUtil.create({
  MATERIAL: [
    1,
    '原料标签模板',
    '',
    {
      // 二维码格式：前缀@箱数@仓库ID@单号
      getQrCode: (item) => `MI@${item.box}@${item.warehouseId}@${item.billCode}`,
    },
  ],
  PRODUCT: [
    2,
    '成品标签模板',
    '',
    {
      // 二维码格式：前缀@箱数@仓库ID@单号
      getQrCode: (item) => `PI@${item.box}@${item.warehouseId}@${item.billCode}`,
    },
  ],
});
